import cv2

t = 1
video = 'http://192.168.123.13:5000/video2'
capture = cv2.VideoCapture(video)

t = 5
while True:
    # if capture.isOpened():
    #     _, frame = capture.read()
    #     cv2.imshow("video", frame)

    _, frame = capture.read()
    t -= 1
    if not t:
        cv2.imwrite("shot0.jpg", frame)
        break

    # waitkey = cv2.waitKey(1)
    # if waitkey == ord('q'): break
    # if waitkey == ord(' '):
    #     cv2.imwrite("shot{}.png".format(t), frame)
    #     t += 1

capture.release()
